﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace My
{
    /// <summary>
    /// MyDropDownList 的摘要描述
    /// </summary>
    public class MyDropDownList : DropDownList
    {
        public MyDropDownList()
        {
            //
            // TODO: 在此加入建構函式的程式碼
            //

            this.DataBound += new EventHandler(MyDropDownList_DataBound);
        }

        void MyDropDownList_DataBound(object sender, EventArgs e)
        {
            if (EmptyText != null)
            {
                this.Items.Insert(0, new ListItem(EmptyText, EmptyValue));
            }
        }

        public string EmptyValue { get; set; }
        public string EmptyText { get; set; }
    }
}